package com.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import org.junit.Test;

public class TestTimeParse {

	@Test
	public void testGetWeekDay(){
		System.out.println(TimeParse.getWeekDay(new Date()));
	}
	
	@Test
	public void testGetWeekLong() throws ParseException{
		SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd");
		Date beginDate = sdf.parse("2013-1-6");
		Date endDate = sdf.parse("2013-1-7");
		System.out.println(TimeParse.getWeekLast(beginDate, endDate));
	}
	
	@Test
	public void testGetWeekNumOfYear(){
		Date date = new Date(System.currentTimeMillis());
		Calendar c = Calendar.getInstance();
		c.setTime(date);
		System.out.println(c.getActualMaximum(Calendar.WEEK_OF_YEAR));
	}
	
	@Test
	public void testgetWeekBeginAndWeekEndDate(){
		Date date = new Date(System.currentTimeMillis());
		Date[] dates=TimeParse.getWeekBeginAndWeekEndDate(date);
		System.out.println(dates[0]);
		System.out.println(dates[1]);
	}
}
